import React from 'react';
import ThemeContext from "./context/ThemeContext";
import UserContext from "./context/UserContext";

class AppBoy extends React.Component {
    render() {
        console.log('AppBoy', this.context)

        return (
            <div>
                <UserContext.Consumer>{
                    value => {
                        // this.context 获取的是ThemeContext的内容
                        return <span style={this.context}>AppBoy {value.username}</span>
                    }
                }</UserContext.Consumer>
            </div>
        )
    }
}

AppBoy.contextType = ThemeContext
export default AppBoy